/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package coms.delegates;

import EJB.EJBLocator;
import coms.dto.Conference;
import coms.dto.ConferenceRegistration;
import coms.dto.Keyword;
import coms.ejb.ConferenceRegistrationBeanRemote;
import java.util.ArrayList;
import java.util.List;

public class ConferenceRegistrationDelegate implements IDelegate<ConferenceRegistration> {
    ConferenceRegistrationBeanRemote conferenceRegistrationBean;
    
    public ConferenceRegistrationDelegate() {
        try {
          conferenceRegistrationBean = EJBLocator.lookupConferenceRegistrationBean();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public boolean create(ConferenceRegistration conferenceRegistration) {        
        conferenceRegistrationBean.create(conferenceRegistration);
        return true;
    }

    @Override
    public boolean delete(ConferenceRegistration conferenceRegistration) {
        conferenceRegistrationBean.delete(conferenceRegistration);        
        return true;
    }

    @Override
    public boolean update(ConferenceRegistration conferenceRegistration) {
        conferenceRegistrationBean.update(conferenceRegistration);
        return true;
    }

    @Override
    public List<ConferenceRegistration> search(ConferenceRegistration conferenceRegistration) {
        return conferenceRegistrationBean.search(conferenceRegistration);
    }

    @Override
    public List<ConferenceRegistration> findAll() throws Exception {
         return conferenceRegistrationBean.findAll();
    }

    @Override
    public ConferenceRegistration getById(int id){
        return conferenceRegistrationBean.getById(id);
    }
    
    public List<ConferenceRegistration> getByConference(Conference conference){
        return conferenceRegistrationBean.getByConference(conference);
    }
    
}
